package com.yunshang.shoppingmall.service.impl;

import com.yunshang.shoppingmall.entity.ProductPrice;
import com.yunshang.shoppingmall.mapper.ProductPriceMapper;
import com.yunshang.shoppingmall.service.ProductPriceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("productPriceService")
public class ProductPriceServiceImpl implements ProductPriceService {
    @Autowired
    ProductPriceMapper productPriceMapper;


    @Override
    public int deleteByPrimaryKey(Integer priceId) {
        return 0;
    }

    /**
     * 增加价格
     * @param productPrice
     * @return
     */
    @Override
    public int insert(ProductPrice productPrice) {
        return productPriceMapper.insert(productPrice);
    }

    @Override
    public int insertSelective(ProductPrice record) {
        return productPriceMapper.insertSelective(record);
    }

    @Override
    public ProductPrice selectByPrimaryKey(Integer priceId) {
        return null;
    }

    @Override
    public int updateByPrimaryKeySelective(ProductPrice record) {
        return productPriceMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKey(ProductPrice record) {
        return productPriceMapper.updateByPrimaryKey(record);
    }

    @Override
    public List<ProductPrice> selectProductPriceByProId(int productId) {
        return productPriceMapper.selectProductPriceByProId(productId);
    }

    /**
     * 根据规格id查询价格
     * @param guigeId
     * @return
     */
    @Override
    public ProductPrice selectProductPriceByGuigeId(int guigeId) {
        return productPriceMapper.selectProductPriceByGuigeId(guigeId);
    }

    @Override
    public ProductPrice selectPriceByProductId(int productId) {
        return productPriceMapper.selectPriceByProductId(productId);
    }
}
